#!/bin/sh

##------- Global settings ----------------------------------------------------

ARCONFIG="`PATH=\"../../lib:${PATH}\" which arevi-config`"
if [ ! -x "${ARCONFIG}" ] ; then
  echo "Cannot find arevi-config !"
  exit 1
fi

ARDIR="`${ARCONFIG} --install`"
ARLIB="${ARDIR}/lib"

CCFLAGS="`${ARCONFIG} --cflags --debug` -I./include"
LDFLAGS="`${ARCONFIG} --ldflags --debug` -lAReViHLib2"

LIB_HINT="`${ARCONFIG} --libvar`"
LIB_HINT="export ${LIB_HINT}=\\\$\$${LIB_HINT}:${ARLIB}:."

##------- Executable settings ------------------------------------------------

EXEC_TARGET="awesome testFIFO testConnectorServer testConnectorClient testModel"

awesome_FULLNAME="awesome"
awesome_FILES="src/fifo.cpp\
               src/connector.cpp\
               src/event.cpp\
               src/element.cpp\
               src/element3D.cpp\
               src/awesomeMan.cpp\
               src/manager.cpp\
               src/environment.cpp\
               src/building.cpp\
               src/city.cpp\
               src/main.cpp"
awesome_CLASSES="${ARLIB}/register-classes src/awesomeClasses.cpp 
                 :: registerAwesomeClasses"

testFIFO_FULLNAME="tests/testFIFO"
testFIFO_FILES="tests/testFIFO.cpp src/fifo.cpp"

testConnectorServer_FULLNAME="tests/testConnectorServer"
testConnectorServer_FILES="tests/testConnectorServer.cpp src/connector.cpp src/fifo.cpp src/event.cpp"

testConnectorClient_FULLNAME="tests/testConnectorClient"
testConnectorClient_FILES="tests/testConnectorClient.cpp src/connector.cpp src/fifo.cpp src/event.cpp"

testModel_FULLNAME="tests/testModel"
testModel_FILES="tests/testModel.cpp"

##----------------------------------------------------------------------------
# Generate `makefile' according to the above settings

set ARLIB LIB_HINT
. ${ARLIB}/build-makefile > makefile

##------- Inserted in makefile -----------------------------------------------
# Specific targets can be resolved before/after `all' or `clean' are called

post_all :
	@if [ ! -h ./GLFonts ] ; then ln -sf ${ARLIB}/GLFonts . ; fi
	@echo ; echo "  ${LIB_HINT}" ; echo

pre_clean :
	rm -rf MyExt/ii_files
	rm -f GLFonts snap.* record.avi

##----------------------------------------------------------------------------
